<?php
/*
 * 数据库连接类
 * 单件模式
 * 使用DBConn::getConnection('host','name','pw','dbname')来获得DB CONNECTION
 * @author liangxinzhao
 */
class DBConn{
    private static $instance = false;
    
    public static function getConnection($host, $db_username, $db_pwd, $db_name){
        if(self::$instance == false){
             self::$instance = mysql_connect($host,$db_username);
             mysql_select_db($db_name);
             mysql_query("SET NAMES UTF8");
        }
        return self::$instance;
    }
    private function  __construct(){
    }
    public function __clone(){
    }
}